import 'dart:convert';
import 'package:convert/convert.dart';
import 'package:http/http.dart';
import 'package:noway/Hitokoto.dart';
void main(){
  var url = 'https://soulofcinder.xyz/hitokoto';
  get(url)
    .asStream()
    .map((resp)=>resp.body)
    .map((str)=>json.decode(str))
    .map((hashMap){
      Hitokoto hitokoto = new Hitokoto();
      hitokoto.id = hashMap['id'];
      hitokoto.fromWhere = hashMap['fromWhere'];
      hitokoto.creator = hashMap['creator'];
      hitokoto.createdAt = hashMap['createdAt'];
      hitokoto.koto = hashMap['koto'];
      return hitokoto;
    }).listen((onData)=>print(onData.koto));
}